package mta.command;

import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;

import java.util.LinkedHashMap;

/**
 * Magento Translation Assistant
 * Copyright (c) 2009 Dmitry Nikolaev
 * Contact author: blackliteon@gmail.com
 */
public class Help implements CommandIF {

    private LinkedHashMap<String, Options> optionsMap = new LinkedHashMap<String, Options>();

    public void addOptions(String name, Options options) {
        optionsMap.put(name, options);
    }

    public void execute() {
        System.out.println("Magento Translator Assistant v 1.0");
        System.out.println("Written by Dmitry Nikolaev");
        System.out.println("http://code.google.com/p/mta-project/");
        System.out.println();

        HelpFormatter formatter = new HelpFormatter();
        for (String name : optionsMap.keySet()) {
            formatter.printHelp(name, optionsMap.get(name));
            System.out.println();
        }
    }
}
